Skip to content

Conversation

@dirien
Copy link
Contributor

@dirien dirien commented Feb 8, 2026

Summary

  • Adds an optional path parameter to the github-card shortcode, allowing links to specific folders or paths within a repository (e.g., tree/master/example-folder)
  • When path is provided, both the link URL and the displayed URL include the full path
  • Extracted from Regen dev version pulumi@3.220.0-alpha.x8adacd2 #17444 to keep changes isolated

Test plan

  • Verify {{< github-card repo="owner/repo" >}} still works as before
  • Verify {{< github-card repo="owner/repo" path="tree/master/folder" >}} links to the correct URL and displays the full path

@claude
Copy link
Contributor

claude bot commented Feb 8, 2026

Review Summary

This change looks good! The implementation cleanly adds an optional path parameter to the github-card shortcode, allowing links to specific folders or paths within a repository.

Code Quality ✅

  • Implementation: The Hugo template logic is clean and handles both scenarios correctly (with and without path)
  • Documentation: The usage comments are clear and include helpful examples
  • Backward Compatibility: Existing usage without path parameter continues to work as before

Observations

Open Graph Image Limitation: When a path parameter is provided, the displayed link and URL correctly point to the specific path, but the Open Graph preview image (line 28) will still show the repository root preview:

src="https://opengraph.githubassets.com/1/{{ $repo }}"

This is expected behavior since GitHub's Open Graph API doesn't generate preview images for specific paths, only for repositories. The preview card will show repository-level information while the link correctly navigates to the specified path. This might be slightly confusing to users, but it's a limitation of GitHub's API rather than an issue with this implementation.

Recommendation

Approve - This is a useful enhancement that maintains backward compatibility and is well-documented.


If you'd like any additional reviews or fixes, feel free to mention me (@claude).

@pulumi-bot
Copy link
Collaborator

Support linking to specific folders within a repo by adding `path` and
`branch` parameters. The branch defaults to "main" so users only need
to provide the folder path.
@dirien dirien force-pushed the dirien/github-card-shortcode branch from c738176 to 7dd8216 Compare February 9, 2026 10:18
@pulumi-bot
Copy link
Collaborator

@dirien dirien merged commit 9c3b271 into master Feb 10, 2026
16 checks passed
@dirien dirien deleted the dirien/github-card-shortcode branch February 10, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants